package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import com.financing.wap.common.CommonConstantUtil;
import com.financing.wap.util.DTOdateSetUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.financing.wap.dto.PrUserAuthDTO;
import com.financing.wap.service.IPrUserAuthService;
import com.financing.wap.dao.IPrUserAuthDao;
/**
 * pr_user_auth  
 * 用户认证 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("prUserAuthService")
public class PrUserAuthServiceImpl implements IPrUserAuthService{

	@Autowired
	private IPrUserAuthDao prUserAuthDao;

	@Override
	public int insert(PrUserAuthDTO prUserAuth) throws SQLException {
		DTOdateSetUtil.setCreateInfo(prUserAuth);
		DTOdateSetUtil.setUpdateInfo(prUserAuth);
		prUserAuth.setDeleteTag(CommonConstantUtil.CommonStatus.DELETE_TAG_NORMAL);
		return prUserAuthDao.insert(prUserAuth);
	}

	@Override
	public void update(PrUserAuthDTO prUserAuth) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(prUserAuth);
		prUserAuthDao.update(prUserAuth);
	}

	@Override
	public void updateForce(PrUserAuthDTO prUserAuth) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(prUserAuth);
		prUserAuthDao.updateForce(prUserAuth);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		prUserAuthDao.delete(id);
	}
	
	@Override
	public List<PrUserAuthDTO> queryList(PrUserAuthDTO prUserAuth) throws SQLException {
		return prUserAuthDao.queryList(prUserAuth);
	}

	@Override
	public int queryListCount(PrUserAuthDTO prUserAuth) throws SQLException {
		return prUserAuthDao.queryListCount(prUserAuth);
	}

	@Override
	public PrUserAuthDTO loadById(Integer id) throws SQLException {
		return prUserAuthDao.loadById(id);
	}
 	@Override
	public PrUserAuthDTO queryListGetFirst(PrUserAuthDTO prUserAuth)
			throws SQLException {
		 List<PrUserAuthDTO> queryList = queryList(prUserAuth);
		 if(queryList==null||queryList.size()==0){
			 return new PrUserAuthDTO();
		 }
		 return queryList.get(0);
	}
}
